<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0  maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>成交记录</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/static/icon_font/iconfont.css">
    <script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<style>
    body {
        background-color: #eff3f6
    }

    header {
        background-color: #fff;
        border-bottom: 1px solid #eff3f6;
        padding: 10px;
    }

    header .white {
        font-size: 26px;
    }

    header h3 {
        margin: 0;
        position: absolute;
        top: 3%;
        left: 50%;
        transform: translateX(-50%);
        font-size: 22px;
    }

    .group {
        background-color: #fff;
        padding: 10px;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #eff3f6;
    }

    .search {
        background-color: #EFF3F6;
        border: none;
        border-radius: 20px;
        width: 260px;
        padding-left: 50px;
    }

    .spng {
        width: 20px;
        height: 20px;
        position: absolute;
        top: 4px;
        left: 16px;
    }

    .btnsearch {
        border: none;
        background-color: #50D2C2;
        color: #fff;
        border-radius: 4px;
        padding: 0px 20px;
    }

    ul {
        list-style: none;
        font-size: 14px;
        padding: 0;
        margin: 0;
        line-height: 26px;
        color: #777;
    }
    .groupList {
        background-color: #fff;
        padding: 10px;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #eff3f6;
    }
</style>

<body>
<header>
    <i class="iconfont white  icon-zuojiantou" id="skip"></i>
    <h3>成交记录</h3>
</header>
<div class="group">
    <div style="position: relative;">
        <img src="__PUBLIC__/static/images/search.png" alt="" class="spng">
        <input type="text" placeholder="搜索房源编号" class="search">
    </div>
    <button class="btnsearch">搜索</button>
</div>
<div class="list">
    <!-- <div class="groupList bbb">
            <ul>
                <li>编号</li>
                <li>跟进结果</li>
                <li>业主</li>
                <li>客户经理</li>
                <li>渠道费</li>
                <li>地址</li>
            </ul>
            <ul style="text-align: right;">
                <li>123478647816784</li>
                <li>已签约</li>
                <li>马大哈</li>
                <li>马二哈</li>
                <li>0.00</li>
                <li>湖北省武汉市江夏区渔牧小区7栋2单元801</li>
            </ul>
    </div> -->
</div>
</body>
<script>
    $(function () {
        $('#skip').click(function(){
            window.location.href = '/wx/user/center'
        })
        $('.btnsearch').click(function () {
            $('.list').html('')
            let hr_serial_number = $('.search').val()
            console.log(hr_serial_number)
            if (hr_serial_number == '') {
                $.ajax({
                    url: '__PUBLIC__/wx/api/serch_housing_resources',
                    type: 'get',
                    data: {},
                    success: (res) => {
                        let arr = JSON.parse(res)
                        console.log(arr);

                        if (arr.code == 0) {
                            if (arr.data.length == 0) {
                                alert('无此房源编号')
                                return
                            }
                            let ar = arr.data
                            var str = ''
                            let bbb = ['', '未跟进', '已联系', '已实勘', '风控处理', '可签约', '已签约', '已失效', '溢出状态']
                            ar.forEach(item=>{
                                // console.log(item);
                                str += `<div class="groupList bbb">
                                    <ul>
                                    <li>编号</li>
                                    <li>跟进结果</li>
                                    <li>业主</li>
                                    <li>客户经理</li>
                                    <li>渠道费</li>
                                    <li>地址</li>
                                    </ul>
                                    <ul style="text-align: right;">
                                    <li>${item.hr_serial_number}</li>
                                    <li>${bbb[item.hr_status]}</li>
                                    <li>${item.hr_owner}</li>
                                    <li>${item.truename}</li>
                                    <li>0</li>
                                    <li>${item.hr_serial_number + item.rq_name}</li>
                                    </ul>
                                    </div>`
                            })
                            console.log(str);

                            $('.list').append(str)
                            console.log(1111);
                        } else {
                            alert(arr.msg)
                        }
                    }
                })
            } else {
                $.ajax({
                    url: '__PUBLIC__/wx/api/serch_housing_resources',
                    type: 'post',
                    data: { hr_serial_number },
                    success: (res) => {
                        let arr = JSON.parse(res)
                        if (arr.code == 0) {
                            if (arr.data.length == 0) {
                                alert('无此房源编号')
                                return
                            }
                            let ar = arr.data
                            var str = ''
                            for (var i = 0;i < ar.length;i++) {
                                str += `<li>${arr[i]}</li> `

                            }
                        } else {
                            alert(arr.msg)
                        }
                    }
                })
            }
        })
    })
</script>

</html>